package lanqiao;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

/**
 * @Project : ProgrammingExercises
 * @Package : LanQiao.PrepareForCompetition
 * @File : Q2038.java
 * @Author : WangRuoyu
 * @Date 2023/3/11 18:50
 */
public class Q2038 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();

        HashSet<Integer> set = new HashSet<>();

        String line = scan.nextLine();
        for (int i = 0; i < n; ++i) {
            line = scan.nextLine();
            String[] words = line.split(" ");
            for (int j = 1; j < words.length; j++) {
                set.add(Integer.valueOf(words[j]));
            }
        }

        ArrayList<Integer> list = new ArrayList<>(set);
        list.sort(((o1, o2) -> o1 - o2));
        for (Integer integer : list) {
            System.out.println(integer);
        }
//4
//13:05:42 103
//14:07:12 4567
//15:03:00 103
//17:00:21 1
    }
}


